package GaoYuXuan.Homework0715;

import java.util.Scanner;

/**
 * @author 盖
 * @version 1.0
 * @since 2022-07-15 18:50:30
 */
public class PalindromeDemo {
    public static void main(String[] args) {
        while (true){
            int flag = 0;
            System.out.println("请输入数字：");
            Scanner input = new Scanner(System.in);
            int num = input.nextInt();
            String number = Integer.toString(num);
            for (int i = 0; i < number.length() / 2; i++){
                if (number.charAt(i) != number.charAt(number.length() - 1 - i)){
                    System.out.println("不是回文！");
                    flag = 1;
                    break;
                }
            }
            if (flag == 0){
                System.out.println("是回文！");
            }
            System.out.println("是否继续？（exit）");
            String whether = input.next();
            if ("exit".equals(whether) || "Exit".equals(whether)){
                break;
            }
        }
    }
}